package functionalinterface;


import java.util.Arrays;
import java.util.Comparator;


public class test {

    public static void main(String[] args) {
        String[] array = { "abc", "ab", "abcd" };
        System.out.println(Arrays.toString(array));
        Arrays.sort(array, newComparator());
        System.out.println(Arrays.toString(array));
    }
    private static Comparator<String> newComparator() {
        return (o1, o2) -> o2.length()-o1.length();
    }
}
